package com.ssy.lingxi.system.controller;

import com.ssy.lingxi.system.model.request.MenuSourceVO;
import com.ssy.lingxi.system.service.IGenerateBaseJsonFileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @menu 生成基础数据JSON文件接口
 * @author wyx
 * @version 2.0.0
 * @date 2021-12-22
 */
@RestController
public class GenerateBaseJsonFileController {
    @Resource
    private IGenerateBaseJsonFileService generateBaseJsonFileService;


    /**
     * 生成基础配置JSON文件
     * @param id 站点ID
     * @return 响应结果
     */
    @RequestMapping(value = "/generate/base/config/json", method = RequestMethod.GET)
    public void baseConfigJsonFile(HttpServletRequest request, HttpServletResponse response, @RequestParam Long id) {
        generateBaseJsonFileService.baseConfigJsonFile(request, response, id);
    }

    /**
     * 生成基础配置TS文件
     * @param id 站点ID
     * @return 响应结果
     */
    @RequestMapping(value = "/generate/base/config/ts", method = RequestMethod.GET)
    public void baseConfigTSFile(HttpServletRequest request, HttpServletResponse response, @RequestParam Long id) {
        generateBaseJsonFileService.baseConfigTSFile(request, response, id);
    }

    /**
     * 权限菜单列表JSON文件
     * @param vo 请求参数
     * @return 响应结果
     */
    @RequestMapping(value = "/generate/menu/tree/json", method = RequestMethod.GET)
    public void menuTreeJsonFile(HttpServletResponse response, MenuSourceVO vo) {
        generateBaseJsonFileService.menuTreeJsonFile(response, vo);
    }
}
